﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace ComboBoxBindings
{
    public enum Sex
    {
        Male,
        Female,
        Unknow,
    }

    public enum EducationGrade
    {
        EducationGrade1,
        EducationGrade2,
        EducationGrade3,
    }

    public class Person : INotifyPropertyChanged
    {
        public Person(int index)
        {
            this.index = index;
            this.name = "Person" + index;
        }

        private Guid id = Guid.NewGuid();
        /// <summary>
        /// Id
        /// </summary>
        public Guid Id
        {
            get
            {
                return id;
            }
        }

        private string name;
        /// <summary>
        /// Name
        /// </summary>
        public string Name
        {
            get
            {
                return name;
            }
            set
            {
                if (name != value)
                {
                    name = value;
                    if (PropertyChanged != null)
                    {
                        PropertyChanged(this, new PropertyChangedEventArgs("Name"));
                    }
                }
            }
        }

        private int index;
        /// <summary>
        /// Index
        /// </summary>
        public int Index
        {
            get
            {
                return index;
            }
            set
            {
                if (index != value)
                {
                    index = value;
                    if (PropertyChanged != null)
                    {
                        PropertyChanged(this, new PropertyChangedEventArgs("Index"));
                    }
                }
            }
        }

        private Sex sex;
        public Sex Sex
        {
            get
            {
                return sex;
            }
            set
            {
                if (sex != value)
                {
                    sex = value;
                    if (PropertyChanged != null)
                    {
                        PropertyChanged(this, new PropertyChangedEventArgs("Sex"));
                    }
                }
            }
        }

        private EducationGrade educationGrade;
        public EducationGrade EducationGrade
        {
            get
            {
                return educationGrade;
            }
            set
            {
                if (educationGrade != value)
                {
                    educationGrade = value;
                    if (PropertyChanged != null)
                    {
                        PropertyChanged(this, new PropertyChangedEventArgs("EducationGrade"));
                    }
                }
            }
        }

        private Guid myDog;
        public Guid MyDog
        {
            get
            {
                return myDog;
            }
            set
            {
                if (myDog != value)
                {
                    myDog = value;
                    if (PropertyChanged != null)
                    {
                        PropertyChanged(this, new PropertyChangedEventArgs("MyDog"));
                    }
                }
            }
        }

        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;

        #endregion
    }
}
